# coding=UTF-8

from django import forms
from django.utils.translation import gettext_lazy as _

class IntegerWidget(forms.TextInput):
    def __init__(self, *args, **kwargs):
        kwargs.setdefault('attrs',{}).update({'size': '2'})
        super(IntegerWidget, self).__init__(*args, **kwargs)

class CommentForm(forms.Form):
    body = forms.CharField(label=_('Comment'), widget=forms.Textarea)
    comment = forms.CharField(widget=forms.HiddenInput, required=False)
    entry = forms.CharField(widget=forms.HiddenInput)
    next = forms.CharField(widget=forms.HiddenInput)

class LoginForm(forms.Form):
    nickname = forms.CharField(label=_('FriendFeed Username'))
    key = forms.CharField(label=_('Remote key'), widget=forms.PasswordInput)

class SearchForm(forms.Form):
    q = forms.CharField(label=_('query'))

class SettingsForm(forms.Form):
    fontsize = forms.IntegerField(label=_('Font size'), min_value=1, widget=IntegerWidget)
    num = forms.IntegerField(label=_('Number of entries'), min_value=1, max_value=30, widget=IntegerWidget)
    newwindow = forms.BooleanField(label=_('Open links in a new window'), required=False)
    googlemobileproxy = forms.BooleanField(label=_('Open links using Google Mobile Proxy'), required=False)
    nomedia = forms.BooleanField(label=_('Don\'t display media'), required=False)
    commentsinlist = forms.IntegerField(label=_('Comments in list view'), min_value=2, max_value=20,widget=IntegerWidget)

class TwitterLoginForm(forms.Form):
    twitter_username = forms.CharField(label=_('Twitter Username'))
    twitter_password = forms.CharField(label=_('Twitter Password'), widget=forms.PasswordInput)
